Add test
authorJakub Matraszek <jakub.matraszek@gmail.com>
Sat, 28 Jan 2017 23:56:30 +0000 (00:56 +0100)
committerJakub Matraszek <jakub.matraszek@gmail.com>
Sat, 28 Jan 2017 23:56:30 +0000 (00:56 +0100)
tests/build.rs

index ced65b219ac61e8d01d4dbe78d1d8e5c88580f9c..6ca86b6d2673ed64e05af06439a9563b47d39ecc 100644 (file)
@@ -2769,3 +2769,30 @@ fn build_all_member_dependency_same_name() {
                        [..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n"));
 }
 
+#[test]
+fn run_proper_binary() {
+    let p = project("foo")
+        .file("Cargo.toml", r#"
+            [package]
+            name = "foo"
+            authors = []
+            version = "0.0.0"
+            [[bin]]
+            name = "main"
+            [[bin]]
+            name = "other"
+        "#)
+        .file("src/lib.rs", "")
+        .file("src/bin/main.rs", r#"
+            fn main() {
+                panic!("This should never be run.");
+            }
+        "#)
+        .file("src/bin/other.rs", r#"
+            fn main() {
+            }
+        "#);
+
+    assert_that(p.cargo_process("run").arg("--bin").arg("other"),
+                execs().with_status(0));
+}